home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows Expert
/
Windows Expert.iso
/
windownt
/
perlnt.zip
/
t
/
io
/
argv.nt
next >
Wrap
Text File
|
1993-07-25
|
1KB
|
49 lines
#!./perl
# $Header: argv.t,v 4.0 91/03/20 01:50:46 lwall Locked $
print "1..5\n";
open(try, '>Ioargv.tmp') || (die "Can't open temp file.");
print try "a line\n";
close try;
#
# N.B. Don't change the spacing of the commands in backticks with out
# making a corresponding adjustment in the string to be compared!
# This is because cmd.exe echos EVERYTHING up to the pipe character.
#
$x = `perl -e "while (<>) {print \$.,\$_;}" Ioargv.tmp Ioargv.tmp`;
if ($x eq "1a line\n2a line\n") {print "ok 1\n";} else {print "not ok 1\n";}
$x = `echo foo| perl -e "while (<>) {print $_;}" Ioargv.tmp -`;
if ($x eq "a line\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";}
$x = `echo foo| perl -e "while (<>) {print $_;}"`;
if ($x eq "foo\n") {print "ok 3\n";} else {print "not ok 3 :$x:\n";}
#@ARGV = ('Ioargv.tmp', 'Ioargv.tmp', '/dev/null', 'Ioargv.tmp');
@ARGV = ('Ioargv.tmp', 'Ioargv.tmp', 'nul:', 'Ioargv.tmp');
while (<>) {
$y .= $. . $_;
if (eof()) {
if ($. == 3) {print "ok 4\n";} else {print "not ok 4\n";}
}
}
if ($y eq "1a line\n2a line\n3a line\n")
{print "ok 5\n";}
else
{print "not ok 5\n";}
`del/q/f Ioargv.tmp`;